// 接口
// interface IUser {
// 	pwd: string
// 	user: string
// 	name?: string
// 	readonly sex: '男' | '女'
// }


// const s1: IUser = {
// 	pwd: '123',
// 	user: '123',
// 	sex: "女",
// 	name: '123'
// } 

// 类
abstract class Animal {
	name: string
	constructor(name: string) {
		this.name = name
	}
}

class Dog extends Animal {
	// 私有属性
	private _type: string

	constructor(name: string, type: string) {
		super(name)
		this._type = type
	}
	// 存储器
	get type(): string {
		return this._type
	}

	set type(newValue: string) {
		this._type = newValue
	}

	sayName() {
		console.log('汪汪汪');
	}
}

class Pig extends Animal {
	constructor(name: string) {
		super(name)
	}
	sayName() {
		console.log('哼哼哼');

	}
}

const d1 = new Dog('狗', '大')
console.log(d1.type);

d1.type = '123'
console.log(d1.type);
console.log(d1);


